package cn.edu.scnu.controller;

import cn.edu.scnu.entity.Movie;
import cn.edu.scnu.mapper.MovieMapper;
import cn.edu.scnu.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/index")
public class ActorSearchController {
    @Autowired
    private MovieService movieService;

    /**
     * 按演员进行检索电影
     * @param actorName
     * @return
     */
    @GetMapping("/searchByActor")
    public List<Movie> searchByActor(@RequestParam String actorName) {
        return movieService.findMoviesByActorName(actorName);
    }
}
